<layout name='layout' />
<div class="admin-main">
	<blockquote class="layui-elem-quote">
		<a href="<{:U('Download/index')}>" class="layui-btn layui-btn-small">
			<i class="layui-icon">&#xe608;</i> 返回列表
		</a>
	</blockquote>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>编辑</legend>
	</fieldset>

	<form id="ajaxForm" class="layui-form" method="post" action="<{:U('Download/edit')}>">
		<div class="layui-form-item">
			<label class="layui-form-label">文件名称</label>
			<div class="layui-input-block">
				<input type="text" name="title" lay-verify="required" placeholder="请输入标题" class="layui-input" value="<{$list['title']}>">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">分类</label>
			<div class="layui-input-block">
				<select name="cid" id="cid" lay-verify="required">
		    	<option value="">==请选择==</option>
		        <volist name="cate" id="vo">
		        <option value="<{$vo['id']}>,<{$vo['path']}>"><php>
		            for($i=0; $i<$vo['count']*2; $i++){
		               echo '&nbsp;&nbsp;';            
		            }
		        </php><{$vo['name']}></option>
		        </volist>
		        </select>
			</div>
		</div>
		<!--div class="layui-form-item">
			<label class="layui-form-label">缩略图</label>
			<div class="layui-inline">
				<img class="thumb" id="picname_src" src="<empty name="list.picname"><{:STATICS}>/image/image.jpg<else/><{$list.picname}></empty>" />
				<input type="hidden" name="picname" id="picname_url" value="<{$list.picname}>" />
			</div>
			<div class="layui-inline">
				<input type="button" value="上传" class="layui-btn layui-btn-small" onclick="uploadfile('<{:U('Upload/image')}>','picname');"/>
				<input type="button" value="删除图片" class="layui-btn layui-btn-small" onclick="delImage('picname')"/>
			</div>
			<div class="layui-inline">
				<input type="checkbox" name="exp" id="exp" value="1" title="以正文第一张为缩略图">
			</div>
		</div-->

		<div class="layui-form-item">
			<label class="layui-form-label">下载地址</label>
			<div class="layui-input-inline" style="width:500px">
				<input type="text" name="url" id="file_url" placeholder="文件的下载地址" class="layui-input"  value="<{$list.url}>"/>	
			</div>
			<div class="layui-input-inline">
			<input type="button" class="layui-btn uploadbtn" value="本地上传" onclick="uploadfile('<{:U('Upload/file')}>','file');"/>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">文件大小</label>
			<div class="layui-input-inline">
				<input type="text" name="filesize" id="file_size" class="layui-input" value="<{$list['filesize']}>">				
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">演示地址</label>
			<div class="layui-input-block">
				<input type="text" name="demo" lay-verify="_url" class="layui-input" value="<{$list['demo']}>">
			</div>
		</div>	

		<div class="layui-form-item">
			<label class="layui-form-label">排序</label>
			<div class="layui-input-inline">
				<input type="text" name="sort" id="sort" class="layui-input" value="<{$list['sort']}>">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">价格</label>
			<div class="layui-input-inline">
				<input type="number" name="price" id="price" class="layui-input" value="<{$list['price']}>" lay-verify="required">
			</div>
		</div>

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">描述</label>
			<div class="layui-input-block">
				<textarea name="intr" class="layui-textarea"><{$list['intr']}></textarea>
			</div>
		</div>

		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">正文</label>
			<div class="layui-input-block">
				<textarea name="content" id="container" lay-verify="content"><{$list['content']}></textarea>
				<script type="text/javascript" src="<{:C('UE_DIR')}>/my.config.js"></script>
				<script type="text/javascript" src="<{:C('UE_DIR')}>/ueditor.all.js"></script>
				<script type="text/javascript" src="<{:C('UE_DIR')}>/lang/zh-cn/zh-cn.js"></script>
				<script type="text/javascript">
				var defPath = "<{:C('UPLOAD_PATH')}>";
				window.UEDITOR_CONFIG.imagePath= defPath;  //插入编辑器中图片路径修正
				window.UEDITOR_CONFIG.filePath= defPath; //插入编辑器中文件路径修正
				window.UEDITOR_CONFIG.scrawlPath= defPath; //涂鸦默认路径
				var editor = UE.getEditor('container');
				</script>
			</div>
		</div>
		<input type="hidden" name="id" value="<{$list['id']}>" />
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
			</div>
		</div>
	</form>
</div>
<!--上传文件-->
<form style="display:none;" id='myupload' action="<{:U('Upload/file')}>" method='post' enctype='multipart/form-data'>
<input id="fileupload" type="file" name="file">
</form>
<div id="uploading" style="display:none;">
	<div class="wrapper">
		<div class="load-bar">   
			<div class="load-bar-inner" data-loading="0"> <span id="counter">0%</span> </div> 
		</div>  
		<p>请等待... </p>
	</div>
</div>
<script type="text/javascript">
$("#cid").val("<{$list['cid']}>,<{$list['path']}>");
</script>
